#pragma once
#include "DLSInfo.h"
#include "array/Array.hpp"
#include "soundbank/ModelByteBuffer.h"
#include "soundbank/SoundbankResource.h"
#include "util/UUID.h"

namespace yzrilyzr_soundbank{
	enum DLSSampleFormat{
		SIGNED, UNSIGNED, FLOAT
	};
	ECLASS(DLSSample, public SoundbankResource){
	public:
	yzrilyzr_util::UUID guid;
	DLSInfo info;
	std::shared_ptr<DLSSampleOptions> sampleoptions;
	std::shared_ptr<ModelByteBuffer> data;
	DLSSampleFormat format;
	uint32_t samplerate;
	uint16_t bits;
	uint16_t channels;
	uint16_t framesize;
	uint32_t framerate;

	DLSSample(Soundbank * soundBank) :SoundbankResource(soundBank, ""){}

	DLSSample() :SoundbankResource(nullptr, ""){}

	DLSInfo getInfo(){
		return info;
	}

	std::shared_ptr<ModelByteBuffer> getDataBuffer(){
		return data;
	}

	void setData(std::shared_ptr<ModelByteBuffer> data){
		this->data=data;
	}

	void setData(std::shared_ptr<yzrilyzr_array::ByteArray> data){
		this->data=std::make_shared<ModelByteBuffer>(data);
	}

	void setData(std::shared_ptr<yzrilyzr_array::ByteArray> data, u_index offset, u_index length){
		this->data=std::make_shared<ModelByteBuffer>(data, offset, length);
	}

	yzrilyzr_lang::String getName()const override{
		return info.name;
	}

	void setName(const yzrilyzr_lang::String & name){
		info.name=name;
	}

	std::shared_ptr<DLSSampleOptions> getSampleoptions(){
		return sampleoptions;
	}

	void setSampleoptions(std::shared_ptr<DLSSampleOptions> sampleOptions){
		this->sampleoptions=sampleOptions;
	}

	yzrilyzr_lang::String toString()const override{
		return "SampleData: " + info.name;
	}

	yzrilyzr_util::UUID & getGuid(){
		return guid;
	}

	void setGuid(yzrilyzr_util::UUID & guid){
		this->guid=guid;
	}
	};
}